<?php

namespace App\Events;

use App\Entity\UserEntity;
use App\VO\Product\MetaInfo\ProductInfo;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class DistributionPosterProductEvent
{
    use Dispatchable; use InteractsWithSockets; use SerializesModels;

    /**
     * @var int
     */
    public $city_id;
    /**
     * @var UserEntity
     */
    public $user;
    /**
     * @var ProductInfo
     */
    public $productInfo;

    /**
     * Create a new event instance.
     *
     * @param int $city_id
     * @param UserEntity $user
     * @param ProductInfo $productInfo
     * @return void
     */
    public function __construct(int $city_id, UserEntity $user, ProductInfo $productInfo)
    {
        $this->city_id = $city_id;
        $this->user = $user;
        $this->productInfo = $productInfo;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
